#!/bin/bash

CName=C-天翼备份
BPath=/home/backup
DPath=/home/docker
CPath=$BPath/$CName

if [[ -d $BPath/$CName.tar.gz ]]; then 
  rm $BPath/$CName.tar.gz
fi
mkdir -p $CPath/{Config,Docker}
cd $CPath

docker save -o Docker/frps.tar.gz newway/frps
docker save -o Docker/nginx.tar.gz newway/nginx
docker save -o Docker/alist.tar.gz newway/alist
docker save -o Docker/wechat-python.tar.gz newway/wechat-python
docker save -o Docker/vpn.tar.gz newway/vpn
docker save -o Docker/redis.tar.gz newway/redis

cd $DPath
tar -zcf frps.tar.gz --exclude==logs frps
tar -zcf alist.tar.gz --exclude==logs alist
tar -zcf nginx.tar.gz --exclude==logs --exclude=html nginx
tar -zcf vpn.tar.gz --exclude==logs vpn
mv *.tar.gz $CPath/Config

cd $BPath
tar -zcf $CName.tar.gz $CName
rm -rf $CName
